package com.levelup.cr.model;

import java.lang.reflect.Method;

/**
 * Created with IntelliJ IDEA.
 * User: denis_zavadsky
 * Date: 8/31/13
 * Time: 11:06 AM
 * To change this template use File | Settings | File Templates.
 */
public interface Adaptable {

    public static class Adapter {
        public static<T extends Adaptable> T adapt(Class<T> clazz, Node node){
            try {
                Method method = clazz.getMethod("adapt", Node.class);
                T result =(T) method.invoke(null, node);
                return result;
            } catch (Exception e){
                e.printStackTrace();
            }
            return null;
        }
    }
}
